-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fixes rl_games workflow's log_root_path to be the absolute path
#3531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
garylvov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
|
Hi @ooctipus, would love to get your opinion before merging on the line: |
|
sorry for the late response, yes I believe this is correct! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Greptile Summary
This PR fixes a bug where log_root_path remained a relative path when PBT (Population-Based Training) is not used, which broke functionality in Ray and potentially other systems that expect absolute paths.
Key Changes
- Restructured the conditional logic to ensure
os.path.abspath()is called when PBT is not enabled or when PBT directory is "." - Successfully addresses the main issue reported in #3530
Issues Found
- The author's concern about PBT path handling is valid: when
agent_cfg["pbt"]["directory"]is set to a relative path or empty string (the default inPbtCfg), the resultinglog_root_pathwill still be relative - Added debug print statement at line 159 that may need removal
Confidence Score: 4/5
- This PR is safe to merge with one logical issue that should be addressed
- The PR successfully fixes the primary bug (non-absolute path when PBT is disabled), but has an edge case where PBT with relative/empty directory still produces relative paths. The fix is simple and the author already identified this concern in the PR description.
- Pay attention to
scripts/reinforcement_learning/rl_games/train.pylines 141-144 for the PBT path handling edge case
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| scripts/reinforcement_learning/rl_games/train.py | 4/5 | Fixes log_root_path to be absolute when PBT is not used, but PBT path handling still has edge cases with relative or empty directory values |
Sequence Diagram
sequenceDiagram
participant Main as main()
participant PathLogic as Path Logic
participant Config as agent_cfg
participant FileSystem as File System
Main->>Config: Read config_name
Main->>PathLogic: Create log_root_path = "logs/rl_games/{config_name}"
alt PBT enabled AND directory != "."
PathLogic->>Config: Get agent_cfg["pbt"]["directory"]
PathLogic->>PathLogic: os.path.join(pbt_dir, log_root_path)
Note over PathLogic: May be relative if pbt_dir is relative/empty!
else No PBT OR directory == "."
PathLogic->>PathLogic: os.path.abspath(log_root_path)
Note over PathLogic: Now absolute (fixes the bug)
end
PathLogic->>Main: Return log_root_path
Main->>FileSystem: Create directories with log_root_path
Main->>FileSystem: dump_yaml() to log_root_path
Main->>Config: Set train_dir = log_root_path
1 file reviewed, 2 comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Greptile Summary
Fixes the missing else clause that caused log_root_path to remain relative when PBT is not used, restoring the absolute path behavior that Ray and other integrations depend on.
Key changes:
- Restructured the PBT directory check to use a single if-else statement
- Added
os.path.abspath()call in the else branch for non-PBT scenarios - Fixed the immediate issue reported in #3530
Remaining issues:
- When PBT is enabled with a relative or empty
directoryvalue (default is""),log_root_pathwill still be relative, which could cause the same issue - The existing comment correctly identifies this concern and suggests wrapping the PBT case with
os.path.abspath()as well - Added a debug print statement on line 159 that should be removed
Confidence Score: 3/5
- Safe to merge but incomplete - fixes the immediate issue while leaving PBT edge case unresolved
- The PR successfully addresses the reported bug for non-PBT scenarios, but the PBT path handling still has the same relative path issue when
agent_cfg["pbt"]["directory"]is relative or empty (default is""). The existing reviewer comment correctly identifies this and provides a solution. Additionally, a debug print statement was added that should be removed. - scripts/reinforcement_learning/rl_games/train.py requires attention to address the PBT relative path issue and remove debug print
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| scripts/reinforcement_learning/rl_games/train.py | 2/5 | Fixes missing else clause for absolute path conversion, but PBT path handling still has issues with relative paths |
Sequence Diagram
sequenceDiagram
participant Main as main()
participant Config as agent_cfg
participant FS as File System
participant RLGames as RL-Games Runner
Main->>Config: Get config_name
Main->>Main: Create relative path<br/>"logs/rl_games/{config_name}"
alt PBT enabled AND directory != "."
Main->>Config: Get pbt["directory"]
Main->>Main: os.path.join(pbt_dir, log_root_path)<br/>(may still be relative!)
else PBT disabled OR directory == "."
Main->>Main: os.path.abspath(log_root_path)<br/>(now absolute ✓)
end
Main->>Config: Set train_dir = log_root_path
Main->>FS: Create directories
Main->>FS: dump_yaml(env.yaml)
Main->>FS: dump_yaml(agent.yaml)
Main->>RLGames: Initialize runner with log_root_path
Note over Main,RLGames: Ray and other integrations<br/>expect absolute paths
1 file reviewed, 1 comment
Description
Due to previous changes, the
rl_gamesworkflow'slog_root_pathis no longer the absolute path if the pbt option is not used, causing further issues. This PR fixes this by making it an absolute path again.Fixes #3530
Type of change
Screenshots
Before:
IsaacLab/scripts/reinforcement_learning/rl_games/train.py
Lines 129 to 135 in 3a0db9d
After:
Note
While this fixes the path to be absolute when pbt is not used, I am not sure if
log_root_path = os.path.join(agent_cfg["pbt"]["directory"], log_root_path)is correct or absolute, as I do not use pbt. Should it not be something like the following?
log_root_path = os.path.abspath(os.path.join(log_root_path, agent_cfg["pbt"]["directory"]))I would appreciate any feedback on this.
Checklist
pre-commitchecks with./isaaclab.sh --formatconfig/extension.tomlfileCONTRIBUTORS.mdor my name already exists there